/*
    标签相关api
*/
var express = require("express");
var router = express.Router();
const parseUrl = require('url');
var queryString = require("querystring")
var sign = require("../controller/sign")

const { sqlQuery } = require('../mysql/index');
const blog = require("../controller/blog");

//获取所有的标签
router.get('/getSignList', (req, res) => {
    sign.getSignList().then(data => {
        res.send(JSON.stringify(data))
    })
})

//获取标签id和其颜色的对应
router.get('/getSignColorList', (req, res) => {
    sign.getColor().then(data => {
        res.send(JSON.stringify(data))
    })
})

//根据id获取标签信息
router.get('/getSignById', (req, res) => {
    let id = req.query.id;
    sign.getSignById(id).then(data => {
        res.send(JSON.stringify(data))
    })
})

//根据标签的id获取该标签对应的博文列表
router.get('/getBlogList', (req, res) => {
    let id = req.query.id;
    sign.getBlogListBySignId(id).then(data => {
        res.send(data)
    })
})




module.exports = router